package org.jeecgframework.web.controller;

import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.web.service.ZyInspectionReportServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * @author onlineGenerator
 * @version V1.0
 * @Title: Controller
 * @Description: 返件报表
 * @date 2018-06-27 09:41:11
 */

@Scope("prototype")
@Controller
@RequestMapping("/zyReturnReportController")
public class zyReturnReportController {

    @Autowired
    private ZyInspectionReportServiceI zyInspectionReportService;

    /**
     * 返件报表 页面跳转
     *
     * @return
     */
    @RequestMapping(params = "zyReturnReport")
    public ModelAndView cbsContract(HttpServletRequest request) {
        return new ModelAndView ( "com/zybk/zy_inspection_report/zyReturnReport" );
    }

    @RequestMapping(params = "queryReturnReportData")
    @ResponseBody
    public List<Map<String, Object>> queryReturnReportData(){
        AjaxJson j = new AjaxJson ();
        List<Map<String, Object>> dataList =  zyInspectionReportService.findReturnReportData();
        return dataList;
    }
    @RequestMapping(params = "queryReturnReportDataFilter")
    @ResponseBody
    public List<Map<String, Object>> queryReturnReportDataFilter(
            @RequestParam(value="returnTime1",defaultValue="")String returnTime1,
            @RequestParam(value="returnTime2")String returnTime2,
            @RequestParam(value="week")Integer week,
            @RequestParam(value="month",required=false)Integer month,
            @RequestParam(value="status",defaultValue="")String status
    ){
        AjaxJson j = new AjaxJson ();
        List<Map<String, Object>> dataList =  zyInspectionReportService.findReturnReportDataFilter(returnTime1,returnTime2,week,month,status);
        return dataList;
    }
}
